package cn.hs.service.impl;

import cn.hs.entity.Reply;
import cn.hs.mapper.ReplyMapper;
import cn.hs.service.ReplyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ReplyServiceImpl
 * @Description TODO
 * @Author mujiale
 * @Date 2024年10月24日 10:09
 * @Version 1.0
 */
@Service
public class ReplyServiceImpl implements ReplyService {
    @Autowired
    private ReplyMapper replyMapper;
    @Override
    public PageInfo<Reply> selectAll(Integer pageNum, Integer pageSize, Reply reply) {
        PageHelper.startPage(pageNum,pageSize);
        List<Reply> replys = replyMapper.selectAll(reply);
        PageInfo pageInfo = new PageInfo(replys);
        return pageInfo;
    }

    @Override
    public int insert(Reply reply) {
        return replyMapper.insert(reply);
    }

    @Override
    public int update(Reply reply) {
        return replyMapper.update(reply);
    }

    @Override
    public int delete(Integer id) {
        return replyMapper.delete(id);
    }

    @Override
    public List<Reply> select(Reply reply) {
        return replyMapper.selectAll(reply);
    }

    @Override
    public Reply selectById(Integer id) {
        return replyMapper.selectById(id);
    }
}
